package com.geostar.gmp.action;

import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.geostar.gmp.dao.IPc_IPDao;
import com.geostar.gmp.global.ConfigValue;
import com.geostar.gmp.model.Pc_ip;
import com.geostar.gmp.model.factory.SessionFactory;
import com.opensymphony.xwork2.ActionSupport;

public class Pc_infoAction extends ActionSupport{

	private static Logger logger = LoggerFactory.getLogger(Pc_infoAction.class);
	
	private static final long serialVersionUID = 3532161905628052939L;

	private List<Pc_ip> pc_infoList;//PC 集合
	private Pc_ip pc_info; //PC POJO

	private String pc_id;//电脑ID
	
	/** @Test **/
	public String insert() throws Exception {
//		int offect = ipcservice.addPc_ip(100);
//		logger.info("插入PIC_IP数据受影响的行数：" + offect);
		logger.info("调用了没，你大爷的");
		return ConfigValue.SUCCESS_INSERT;
	}
	
	public String findAllPc_info() throws Exception {
		SqlSession session = SessionFactory.createSession();
		IPc_IPDao dao = session.getMapper(IPc_IPDao.class);
		this.pc_infoList = dao.findAllPc_ip();
		logger.info("pc_infoList的size():" + this.pc_infoList.size());
		
		SessionFactory.createSession();
		return SUCCESS;
	}

	public String findPcById() throws Exception {
//		this.pc_info = ipcservice.findOnePcById(this.pc_id);
		return ConfigValue.SUCCESS_RIGHT;
	}
	
	// get and  set
	public List<Pc_ip> getPc_infoList() {
		return pc_infoList;
	}

	public void setPc_infoList(List<Pc_ip> pc_infoList) {
		this.pc_infoList = pc_infoList;
	}

	public Pc_ip getPc_info() {
		return pc_info;
	}

	public void setPc_info(Pc_ip pc_info) {
		this.pc_info = pc_info;
	}

	public String getPc_id() {
		return pc_id;
	}

	public void setPc_id(String pc_id) {
		this.pc_id = pc_id;
	}
}
